package _1_常用数据类型_关键字;

import java.util.Arrays;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class ArrayUse {

  @Test
  public void doubleArray() {
    double[][][] a = {
        {{20, 25}, {35}, {40}, {40, 50}},
        {{15, 20}, {30}, {35}, {40}},
        {{15}, {20, 25}, {30}, {35}}
    };
    String laborType = "卧床";
    Map<String, Integer> laborTypeIndex = new HashMap<String, Integer>(8) {{
      put("卧床", 0);
      put("卧床2", 2);
      put("卧2", 1);
    }};

    double bmi = (new Random().nextDouble()) * (new Random().nextInt(100));
    int index1 = bmi < 18.5 ? 0 : (bmi >= 24 ? 2 : 1);
    int index2 = laborTypeIndex.getOrDefault(laborType, 0);
    double[] doubles = a[index1][index2];
    System.out.println(Arrays.toString(doubles));
  }

}
